{include file="public/_meta" /}
<body>
<style>
    .required_b{
        color: red;
    }

</style>
<div class="wrapper">

    {include file="public/_header" /}

    <!-- Sidebar -->
    {include file="public/_menu" /}
    <!-- End Sidebar -->

    <div class="main-panel">

        <div class="content">
            <div class="page-inner">

                <!-- 面包屑 -->
                {include file="public/_page_header" /}

                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <div class="d-flex align-items-center">
                                    <h4 class="card-title">线索成本明细</h4>

                                </div>

                                <form class="row" id="formSelect">

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="ac_name" value="{$ac_name}" placeholder="账户名称">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="adv_id" value="{$adv_id}" placeholder="账户ID">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="clue_id" value="{$clue_id}" placeholder="线索ID">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="clue_name" value="{$clue_name}" placeholder="线索名称">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="phone" value="{$phone}" placeholder="电话">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="mer_name" value="{$mer_name}" placeholder="商户名称">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="num" value="{$num}" placeholder="重复次数">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-3">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="err_msg" name="err_msg" value="{$err_msg}" placeholder="推送失败原因">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="cityname" value="{$cityname}" placeholder="请输入城市">
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">

                                            <select class="form-control input-full" name="channel_id" id="channel_id">
                                                <option value="">全部渠道</option>
                                                {volist name="channels" id="vo"}
                                                <option value="{$key}">{$vo}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">

                                            <select class="form-control input-full" name="pro_id" id="pro_id">
                                                <option value="">全部产品</option>
                                                {volist name="products" id="vo"}
                                                <option value="{$key}">{$vo}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="status">
                                                <option value="99"  {if condition="$status eq 99"}selected{/if}>全部状态</option>
                                                <option value="1"  {if condition="$status eq 1"}selected{/if}>已推送</option>
                                                <option value="0"  {if condition="$status eq 0"}selected{/if}>未推送</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">

                                            <select class="form-control input-full" name="pstatus[]" id="pstatus" multiple="multiple">
                                                <option value="0">全部跟进状态</option>
                                                {volist name="endStatus" id="vo"}
                                                <option value="{$vo.id}">{$vo.name}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="is_find">
                                                <option value=""  {if condition="$is_find eq ''"}selected{/if}>全部推送方式</option>
                                                <option value="0"  {if condition="$is_find eq '0'"}selected{/if}>自动推送</option>
                                                <option value="1"  {if condition="$is_find eq 1"}selected{/if}>手动推送</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="is_not_push" id="is_not_push">
                                                <option value="" >分润推送</option>
                                                <option value=0 >正常推送</option>
                                                <option value=1 >已分润</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="is_follow" id="is_follow">
                                                <option value="" >是否已跟进</option>
                                                <option value=1 >已跟进</option>
                                                <option value=0 >未跟进</option>
                                            </select>
                                        </div>
                                    </div>



<!--                                    <div class="col-md-6 col-lg-2">-->
<!--                                        <div class="form-group">-->
<!--                                            <select class="form-control" name="source">-->
<!--                                                <option value="0">全部线索来源</option>-->
<!--                                                {volist name="sources" id="vo"}-->
<!--                                                <option value="{$vo.source}" {if condition="$vo.source eq $source"}selected{/if}>{$vo.source}</option>-->
<!--                                                {/volist}-->
<!--                                            </select>-->
<!--                                        </div>-->
<!--                                    </div>-->



                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="times2" id="times2" value="{$times2}" placeholder="推送时间" autocomplete="off">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="stat_type" id="stat_type">
                                                <option value="1" selected>单日成本</option>
                                                <option value="2">7天成本(周一至周日)</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-lg-2" style="display: none;" id="stat_type_for_week">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="week-selector" placeholder="选择周" name="week" value="{$week}" autocomplete="off">
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2" id="stat_type_for_day">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="times" id="times" value="{$times}" placeholder="创建时间" autocomplete="off">
                                        </div>
                                    </div>


                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control" name="orderBy" id="orderBy">
                                                <option value="" >默认排序</option>
                                                <option value='1' >账户币成本升序</option>
                                                <option value='2' >账户币成本降序</option>
                                                <option value='3' >真实币成本升序</option>
                                                <option value='4' >真实币成本降序</option>
                                                <option value='5' >账户币修正成本1升序</option>
                                                <option value='6' >账户币修正成本1降序</option>
                                                <option value='7' >真实币修正成本1升序</option>
                                                <option value='8' >真实币修正成本1降序</option>
                                                <option value='9' >账户币修正成本2升序</option>
                                                <option value='10' >账户币修正成本2降序</option>
                                                <option value='11' >真实币修正成本2升序</option>
                                                <option value='12' >真实币修正成本2降序</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">

                                            <select class="form-control input-full" name="youhua_id" id="youhua_id">
                                                <option value="">全部优化师</option>
                                                {volist name="youhua" id="vo"}
                                                <option value="{$vo.uid}">{$vo.realname}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>

                                    <!--<div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <select class="form-control input-full" name="pay_type" id="pay_type">
                                                <option value="">付费类型</option>
                                                <option value="1">先付费</option>
                                                <option value="2">后付费</option>
                                            </select>
                                        </div>
                                    </div>-->

                                    <div class="col-md-6 col-lg-2">
                                        <div class="form-group">
                                            <button type="submit" class="btn btn-primary">查询</button>
                                            <button type="button" class="btn btn-primary" onclick="dataexport()" >导出</button>
                                            <a href="{:url('clue/cluecostdetails')}" class="btn btn-info" style="color: white;position: absolute;left: 220px;">重置</a>
                                        </div>
                                    </div>

                                </form>

                            </div>

                            <div class="layui-card-body">

                                <blockquote class="layui-elem-quote layui-quote-nm">
                                    <span style="margin-right: 50px;">账户成本：{$price}</span><span style="margin-right: 50px;">真实成本：{$true_price}</span><span style="margin-right: 50px;">账户币修正成本1：{$xz_price}</span><span style="margin-right: 50px;">真实币修正成本1：{$xz_true_price}</span><span style="margin-right: 50px;">账户币修正成本2：{$xz_price2}</span><span style="margin-right: 50px;">真实币修正成本2：{$xz_true_price2}</span>
                                    <br>
                                    <span style="margin-right: 50px;">账户币修正成本3：{$xz_price3}</span><span style="margin-right: 50px;">真实币修正成本3：{$xz_true_price3}</span>
                                    <br>
                                    <span style="margin-right: 50px;">账户币修正成本4：{$xz_price4}</span><span style="margin-right: 50px;">真实币修正成本4：{$xz_true_price4}</span>
                                    <br>
                                    <span style="margin-right: 50px;">7天周期账户成本：{$week_price}</span><span style="margin-right: 50px;">7天周期真实成本：{$week_true_price}</span>
                                </blockquote>
                            </div>


                            <div class="card-body">
                                <!-- Modal -->
                                <div class="modal fade" id="addRowModal" tabindex="-1" role="dialog" aria-hidden="true">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header no-bd">
                                                <h5 class="modal-title">
                                                    <span class="fw-mediumbold">添加</span>

                                                </h5>
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                    <span aria-hidden="true">&times;</span>
                                                </button>
                                            </div>
                                            <div class="modal-body">
                                                <form id="form-modal">
                                                    <div class="row">

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="clue_name" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">线索名称 <b class="required_b">*</b> </font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="clue_name" name="clue_name" placeholder="线索名称">
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="phone" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">电话<b class="required_b">*</b></font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="phone" name="phone" placeholder="电话">
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="apply_limit" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">申请金额<b class="required_b">*</b></font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="apply_limit" name="apply_limit" placeholder="申请金额">
                                                            </div>
                                                        </div>

                                                        <div class="form-check form-inline col-md-12">
                                                            <div class="col-md-8 p-0">
                                                                <div class="form-check">
                                                                    <label class="col-md-3 col-form-label"><font style="vertical-align: inherit;">性别</font></label>
                                                                    <label class="form-radio-label" style="margin-left: 20px;">
                                                                        <input class="form-radio-input" type="radio" name="gender" value="1" checked="">
                                                                        <span class="form-radio-sign">男</span>
                                                                    </label>
                                                                    <label class="form-radio-label ml-3">
                                                                        <input class="form-radio-input" type="radio" name="gender" value="2">
                                                                        <span class="form-radio-sign">女</span>
                                                                    </label>
                                                                    <label class="form-radio-label ml-3">
                                                                        <input class="form-radio-input" type="radio" name="gender" value="0">
                                                                        <span class="form-radio-sign">未知</span>
                                                                    </label>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="age" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">年龄</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="age" name="age" placeholder="年龄">
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">省份/直辖市</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <select class="form-control input-full" name="province" id="province" onchange="loadRegion('province',2,'city')">
                                                                    <option value="0">省份/直辖市</option>
                                                                    {volist name="province" id="vo"}
                                                                    <option value="{$vo.id}">{$vo.name}</option>
                                                                    {/volist}
                                                                </select>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="city" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">市/县</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <select class="form-control input-full" name="city" id="city" onchange="loadRegion('city',3,'town')">
                                                                    <option value="0">市/县</option>
                                                                </select>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="source" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">来源</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="source" name="source" placeholder="来源">
                                                            </div>
                                                        </div>
                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="wx_id" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">微信号</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="wx_id" name="wx_id" placeholder="微信号">
                                                            </div>
                                                        </div>
                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="qq" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">QQ号</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="qq" name="qq" placeholder="QQ号">
                                                            </div>
                                                        </div>
                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="email" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">邮箱</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="email" name="email" placeholder="邮箱">
                                                            </div>
                                                        </div>
                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="remark" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">备注</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <textarea id="remark" name="remark" class="form-control input-full" style="height: 300px!important"></textarea>
                                                            </div>
                                                        </div>

                                                    </div>
                                                    <div class="modal-footer no-bd">
                                                        <input type="hidden" id="id" name="id" value="">
                                                        <button type="submit" id="addRowButton" class="btn btn-primary">保存</button>
                                                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                                                    </div>
                                                </form>
                                            </div>

                                        </div>
                                    </div>
                                </div>

                                <div class="modal fade" id="addRowModal2" tabindex="-1" role="dialog" aria-hidden="true">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header no-bd">
                                                <h5 class="modal-title">
                                                    <span class="fw-mediumbold">推送</span>

                                                </h5>
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                    <span aria-hidden="true">&times;</span>
                                                </button>
                                            </div>
                                            <div class="modal-body">
                                                <form id="form-modal2">
                                                    <div class="row">

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">推送商户</font></label>
                                                            <div class="col-md-8 p-0 ">
                                                                <div class="layui-form">
                                                                <select lay-verify="required" lay-search="" name="merchant" id="merchant"  onchange="loadRule('merchant','mrule')">
                                                                    <option value="0">--选择或输入-- </option>
                                                                    {volist name="merchants" id="vo"}
                                                                    <option value="{$vo.id}">【{$vo.mer_name}】【账号{$vo.username}】(联系电话{$vo.phone})</option>
                                                                    {/volist}
                                                                </select>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">分发规则</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <select class="form-control input-full" name="mrule" id="mrule">
                                                                    <option value="0">--请选择--</option>
                                                                </select>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;color: red">显示城市</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="show_city" name="show_city"  placeholder="商户端显示城市">

                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;color: red">显示渠道</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="push_channel" name="push_channel"  placeholder="商户端显示渠道">

                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="clue_name" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">线索名称  </font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="clue_name2"  placeholder="线索名称" disabled>
                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="phone" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">电话</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <input type="text" class="form-control input-full" id="phone2"  placeholder="电话" disabled>
                                                            </div>
                                                        </div>


                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="province" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">城市</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <div id="city2"></div>

                                                            </div>
                                                        </div>

                                                        <div class="form-group form-inline col-md-12">
                                                            <label for="remark" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">备注</font></label>
                                                            <div class="col-md-8 p-0">
                                                                <textarea id="remark2"  class="form-control input-full" style="height: 300px!important" disabled></textarea>
                                                            </div>
                                                        </div>

                                                    </div>
                                                    <div class="modal-footer no-bd">
                                                        <input type="hidden" id="id2" name="id" value="">
                                                        <button type="submit" id="addRowButton2" class="btn btn-primary">推送</button>
                                                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                                                    </div>
                                                </form>
                                            </div>

                                        </div>
                                    </div>
                                </div>


                                <div class="table-responsive">
                                    <div class="layui-box layui-laypage layui-laypage-molv">{:pagination($infos)}</div>
                                    <table id="add-row" class="display table table-striped table-hover" >
                                        <thead>
                                        <tr>
                                            <th><input type="checkbox" class="check">全选</th>
                                            <th>ID</th>
                                            <th>渠道产品</th>
                                            <th>线索账户</th>
                                            <th>线索信息</th>
                                            {if condition="!in_array($group_id,[7])"}
                                            <th>推送商户</th>
                                            {/if}
<!--                                            <th>申请金额</th>-->
                                            <th>账户成本</th>
                                            <th>真实成本</th>
                                            <th>账户币修正成本1<br>先给0成本的线索安上成本<br>然后再摊空耗的成本到线索上<br>【最后总成本大于导入的总成本】</th>
                                            <th>真实币修正成本1</th>
                                            <th>账户币修正成本2<br>直接摊空耗的成本到线索上<br>【哪怕有些线索成本为0就是0<br>最后总成本等于导入的总成本】</th>
                                            <th>真实币修正成本2</th>
                                            <th>账户币修正成本3</th>
                                            <th>真实币修正成本3</th>
                                            <th>账户币修正成本4</th>
                                            <th>真实币修正成本4<br>空耗的成本摊到【日期+账号】线索上<br>没有【日期+账号】线索则不平摊<br>【最后总成本可能小于导入的总成本】<br>仅供投放账户统计使用</th>
                                            <th>7天周期账户成本</th>
                                            <th>7天周期真实成本</th>
                                            <th>时间</th>
<!--                                            <th>成本</th>-->
                                            <th>线索状态</th>

                                        </tr>
                                        </thead>

                                        <tbody>

                                        {volist name="infos" id="vo"}
                                        <tr>
                                            <td><input type="checkbox" class="check" value="{$vo.id}" name="idcheckbox"></td>
                                            <td>{$vo.id}</td>
                                            <td>{$vo.channel_name}<br>
                                                {$vo.product_name}</td>
                                            <td>
                                                账户ID：【{$vo.adv_id}】<br>
                                                名称：{$vo.acc_name}<br>
                                                简称：{$vo.acc_desc}
                                            </td>
                                            <td>
                                                {if condition="!in_array($group_id,[7])"}
                                                名称：{$vo.clue_name}<br>
                                                电话：{$vo.phone}<br>
                                                {/if}
                                                城市：{$vo.city}
                                                {if $vo.clue_city != ''}
                                                <br>广告城市：{$vo.clue_city}
                                                {/if}

                                            </td>
                                            {if condition="!in_array($group_id,[7])"}
                                            <td>
                                                账号：{$vo.username}<br>
                                                手机：{$vo.mphone}<br>
                                                商户名：{$vo.mer_name}
                                                {if $vo.push_type == 1}
                                                <span style="color: #007bff;font-size:10px;border: 1px solid #007bff;padding: 1px;border-radius: 5px">API</span>
                                                {/if}
                                                <br>
                                                推送城市：{$vo.push_city}
                                                {if $vo.show_city != ''}
                                                <br>
                                                显示城市：{$vo.show_city}
                                                {/if}
                                                {if $vo.push_channel != ''}
                                                <br>
                                                显示渠道：{$vo.push_channel}
                                                {/if}
                                            </td>
                                            {/if}
<!--                                            <td>{$vo.apply_limit}</td>-->
                                            <td>{$vo.price}</td>
                                            <td>{$vo.true_price}</td>
                                            <td>{$vo.xz_price}</td>
                                            <td>{$vo.xz_true_price}</td>
                                            <td>{$vo.xz_price2}</td>
                                            <td>{$vo.xz_true_price2}</td>
                                            <td>{$vo.xz_price3}</td>
                                            <td>{$vo.xz_true_price3}</td>
                                            <td>{$vo.xz_price4}</td>
                                            <td>{$vo.xz_true_price4}</td>
                                            <td>{$vo.week_price}</td>
                                            <td>{$vo.week_true_price}</td>
                                            <td>创建时间：{$vo.create_time}<br>
                                                推送时间：{$vo.push_time}<br>
                                                更新时间：{$vo.update_time}
                                            </td>
<!--                                            <td>{$vo.price}</td>-->
                                            <td style="white-space: pre-wrap;align-items: center;" class="statustd" >
                                                {if $vo.is_black==1}
                                                <span style="color: red;font-size:10px;border: 1px solid red;padding: 2px;border-radius: 5px">黑名单</span>
                                                {/if}
                                                {if $vo.is_not_push==1}
                                                <span style="color: #2e8ded;font-size:12px;border: 1px solid #2e8ded;padding: 2px;border-radius: 5px">已分润</span>
                                                {/if}
                                                {if $vo.status ==0 }
                                                <div style="width: 100px;">
                                                {$vo.status|getClueStatus}
<!--                                                <span style="color: red">{$vo.err_msg}</span>-->
<!--                                                <span style="color: red">{$vo.err_msg}</span>-->
<!--                                                <span style="color: red">{$vo.err_msg}</span>-->






                                                </div>
                                                {else /}
                                                {$vo.status|getClueStatus}
                                                {if $vo.is_find == 1}
                                                {if condition="!in_array($group_id,[7])"}
                                                <span style="color: red;font-size:10px;border: 1px solid red;padding: 2px;border-radius: 5px">手动</span>
                                                {/if}
                                                {/if}
                                                {/if}
                                            </td>

                                        </tr>

                                        {/volist}

                                        </tbody>
                                    </table>

                                    <!-- 分页 (调取通用方法)-->
                                    <div class="layui-box layui-laypage layui-laypage-molv">{:pagination($infos)}</div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        {include file="public/_footer" /}


    </div>



</div>

{include file="public/_js" /}

</body>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

    $("#stat_type").change(function () {
        var type = $(this).val();
        if (type == 1) { // 单日
            $("#stat_type_for_day").show();
            $("#stat_type_for_week").hide();
        } else if (type == 2) { // 周期
            $("#stat_type_for_day").hide();
            $("#stat_type_for_week").show();
        }
    });


    var SCOPE = {
        'status_url':"{:url('clue/status')}",
        'status_black':"{:url('clue/backStatus')}",
        'status_urla':"{:url('clue/statusAll')}",
        'delete_url':"{:url('clue/delete')}",
        'delete_url2':"{:url('clue/delete2')}",
        'delete_url3':"{:url('clue/backPushClue')}",
        'item_url':"{:url('clue/edit')}",
        'item_url2':"{:url('clue/edit2')}",
        'item_url3':"{:url('clue/edit3')}",
        'add_url':"{:url('clue/save')}",
        'clue_url':"{:url('clue/clue_url')}",
        'city_url':"{:url('clue/getRegion')}",
        'push_rule':"{:url('clue/getMerchantPush')}",
        'push_url':"{:url('clue/findPush')}",
    };



    function dataexport(){


        var formData = $('#formSelect').serialize();

        location.href="{:url('clue/indexExport')}"+'?'+formData;
    }

    function editprogress(cid,id){

        layer.prompt({
            title: '修改',
            formType: 2
        }, function (text, index) {
            $.ajax({
                type: "post",
                url: "{:url('clue/saveProgress')}",
                data: {
                    content: text,
                    cid: cid,
                    id: id,
                },
                dataType: 'json',
                success: function (data) {
                    layer.close(index);
                    if (data.code == 400) {
                        layer.msg(data.msg, {
                            time: 1200,
                            icon: 0,
                        });
                    } else if (data.code == 1001) {
                        layer.msg(data.msg, {
                            time: 1200,
                            icon: 1,
                            end: function () {
                                window.location.reload(true);
                            }
                        });
                    }
                }
            });
        });
    }

    function delprogress(id){
        layer.confirm('确认删除跟进记录？',function(index){
            $.ajax({
                type: 'POST',
                url:"{:url('clue/delProgress')}",
                dataType: 'json',
                data: {id:id},
                success: function(data){
                    if(data.code == 1001){

                        layer.msg(data.msg,{icon:1,time:2000, end: function () {
                                window.location.reload(true);
                            }});
                    }else{
                        layer.msg(data.msg,{icon:2,time:2000});
                    }

                },
                error:function(data) {
                    layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
                }
            });
        });
    }


    function loadRule(sel,selName){
        $("#"+selName+" option").each(function(){
            $(this).remove();
        });
        $("<option value=0>请选择</option>").appendTo($("#"+selName));
        if($("#"+sel).val()==0){
            return;
        }
        $.post(SCOPE.push_rule,{pid:$("#"+sel).val()},
            function(data){
                if(data.code == 1001){
                    $.each(data.data,function(idx,item){
                        $("<option value="+item.id+">【"+item.dcity+"】【"+item.dcharge_type+"】(单价"+item.price+")</option>").appendTo($("#"+selName));
                    });
                }else{
                    $("<option value='0'>请选择</option>").appendTo($("#"+selName));
                }
            }
        );
    }

    function loadRegion(sel,type_id,selName){
        $("#"+selName+" option").each(function(){
            $(this).remove();
        });
        $("<option value=0>请选择</option>").appendTo($("#"+selName));
        if($("#"+sel).val()==0){
            return;
        }
        $.post(SCOPE.city_url,{pid:$("#"+sel).val(),type:type_id},
            function(data){
                if(data.code == 1001){
                    $.each(data.data,function(idx,item){
                        $("<option value="+item.id+">"+item.name+"</option>").appendTo($("#"+selName));
                    });
                }else{
                    $("<option value='0'>请选择</option>").appendTo($("#"+selName));
                }
            }
        );
    }

    $(function(){
        var commitStatus = false;
        /*表单验证*/
        $("#form-modal").validate({
            rules:{
                clue_name:{
                    required:true,
                    maxlength:30
                },
                phone:{
                    required:true,
                    number:true,
                    minlength:11,
                    maxlength:11
                },
                age:{
                    number:true
                },
                email:{
                    email:true,
                    maxlength:100
                },
                wx_id:{
                    maxlength:30
                },
                qq:{
                    maxlength:30
                },
                remark:{
                    maxlength:300
                }

            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                var url = SCOPE.add_url;
                if(commitStatus==true){
                    return false;
                }
                var province = $("#province").val();
                var city = $("#city").val();
                if(province != 0 && city == 0){
                    layer.msg('请选择市/县',{icon:2,time:2000});
                    return false;
                }
                /*表单提交*/
                $(form).ajaxSubmit({
                    type: 'post',
                    url: url,
                    success: function(data){
                        if(data.code == 1001){
                            commitStatus = true;
                            layer.msg(data.msg, {
                                icon: 1,
                                time: 2000
                            }, function(){
                                parent.location.reload();
                            });
                        }else{
                            layer.msg(data.msg,{icon:2,time:2000});
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg(errorThrown,{icon:2,time:2000});
                    }
                });

            }
        });

    });

    //指定推送
    $(function(){
        var commitStatus = false;
        /*表单验证*/
        $("#form-modal2").validate({

            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                var url = SCOPE.push_url;
                if(commitStatus==true){
                    return false;
                }

                var loading = layer.load(0, {
                    shade: true,
                    time: 10*1000
                });
                /*表单提交*/
                $(form).ajaxSubmit({
                    type: 'post',
                    url: url,
                    success: function(data){
                        if(data.code == 1001){
                            commitStatus = true;
                            layer.msg(data.msg, {
                                icon: 1,
                                time: 2000
                            }, function(){
                                layer.close(loading);
                                parent.location.reload();
                            });
                        }else{
                            layer.msg(data.msg,{icon:2,time:3000});
                            layer.close(loading);
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg(errorThrown,{icon:2,time:2000});
                    }
                });

            }
        });

    });

    function add_item(id) {
        $("input[name='id']").val(id);
        document.getElementById('form-modal').reset();
        $("#city").children().remove();
        $("<option value='0'>请选择</option>").appendTo($("#city"));
        $(".fw-mediumbold").text('添加');
    }

    function edit_item(id) {
        $("#city").children().remove();
        $("<option value='0'>请选择</option>").appendTo($("#city"));
        $.ajax({
            type: 'GET',
            url: SCOPE.item_url,
            dataType: 'json',
            data: {id:id},
            success: function(res){
                if(res.code == 1001){
                    $(".fw-mediumbold").text('编辑');
                    $("#id").val(res.data.id);
                    $("#clue_name").val(res.data.clue_name);
                    $("#phone").val(res.data.phone);
                    $("#age").val(res.data.age);
                    $("#source").val(res.data.source);
                    $("#email").val(res.data.email);
                    $("#wx_id").val(res.data.wx_id);
                    $("#qq").val(res.data.qq);
                    $("#remark").val(res.data.remark);
                    $(":radio[name='gender'][value='"+res.data.gender+"']").prop("checked","checked");
                    $("#province").val(res.data.prov);
                    $("#apply_limit").val(res.data.apply_limit);
                    if(res.data.city != ''){
                        $("#city").children().remove();
                        $("<option value='"+res.data.city+"'>"+res.data.city_name+"</option>").appendTo($("#city"));
                    }
                }else{
                    layer.msg(res.msg,{icon:2,time:2000});
                }

            },
            error:function(res) {
                layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
            }
        });
    }

    function edit_item2(id,city) {
        $("#mrule").children().remove();
        $("<option value='0'>请选择</option>").appendTo($("#mrule"));
        $.ajax({
            type: 'GET',
            url: SCOPE.item_url2,
            dataType: 'json',
            data: {id:id},
            success: function(res){
                if(res.code == 1001){
                    $(".fw-mediumbold").text('推送');
                    $("#id2").val(res.data.id);
                    $("#clue_name2").val(res.data.clue_name);
                    $("#phone2").val(res.data.phone);

                    $("#remark2").val(res.data.remark);
                    $("#city2").text(city);


                }else{
                    layer.msg(res.msg,{icon:2,time:2000});
                }

            },
            error:function(res) {
                layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
            }
        });
    }

    function edit_item3() {
        $("#mrule").children().remove();
        $("<option value='0'>请选择</option>").appendTo($("#mrule"));
        $.ajax({
            type: 'GET',
            url: SCOPE.item_url3,
            dataType: 'json',
            success: function(res){
                if(res.code == 1001){

                    var chk_value =[];
                    $('input[name="idcheckbox"]:checked').each(function(){ //遍历，将所有选中的值放到数组中
                        chk_value.push($(this).val());
                    });

                    $(".fw-mediumbold").text('推送');
                    $("#id2").val(chk_value);
                    $("#clue_name2").val('批量多条线索');
                    $("#phone2").val('批量多条线索');

                    $("#remark2").val('批量多条线索');
                    $("#city2").text('批量多条线索');



                }else{
                    layer.msg(res.msg,{icon:2,time:2000});
                }

            },
            error:function(res) {
                layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
            }
        });
    }



    /*删除*/
    function admin_del(obj,id){
        layer.confirm('确认要直接删除,不退款吗？',function(index){
            $.ajax({
                type: 'POST',
                url: SCOPE.delete_url,
                dataType: 'json',
                data: {id:id},
                success: function(data){
                    if(data.code == 1001){
                        $(obj).parents("tr").remove();
                        layer.msg('删除线索成功!',{icon:1,time:2000});
                    }else{
                        layer.msg(data.msg,{icon:2,time:2000});
                    }

                },
                error:function(data) {
                    layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
                }
            });
        });
    }

    /*删除*/
    function admin_del2(obj,id){
        layer.confirm('确认要删除并且退款吗？',function(index){
            $.ajax({
                type: 'POST',
                url: SCOPE.delete_url2,
                dataType: 'json',
                data: {id:id},
                success: function(data){
                    if(data.code == 1001){
                        $(obj).parents("tr").remove();
                        layer.msg('删除线索成功!',{icon:1,time:2000});
                    }else{
                        layer.msg(data.msg,{icon:2,time:2000});
                    }

                },
                error:function(data) {
                    layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
                }
            });
        });
    }

    /*撤回*/
    function admin_del3(obj,id){
        layer.confirm('确认要撤回推送并且退款吗？',function(index){
            $.ajax({
                type: 'POST',
                url: SCOPE.delete_url3,
                dataType: 'json',
                data: {id:id},
                success: function(data){
                    if(data.code == 1001){
                        layer.msg('撤回线索成功!',{icon:1,time:2000});
                        window.location.reload();
                    }else{
                        layer.msg(data.msg,{icon:2,time:2000});
                    }

                },
                error:function(data) {
                    layer.msg('网络错误,稍后再试...',{icon:2,time:2000});
                }
            });
        });
    }


    /*机构-停用*/
    function admin_stop(obj,id){
        layer.confirm('确认要禁止推送吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            var url = SCOPE.status_url;
            $.post(url,{status:2,id:id},function(data){
                if(data.code == 1001){
                    layer.msg('已禁止推送!',{icon: 1,time:1000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon: 2,time:1000});
                }

            });


        });
    }

    /*机构-启用*/
    function admin_start(obj,id){
        layer.confirm('确认要推送线索吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……

            var url = SCOPE.status_url;
            $.post(url,{status:1,id:id},function(data){
                if(data.code == 1001){

                    layer.msg('已推送!',{icon: 1,time:1000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon: 2,time:1000});
                }
            });
        });
    }

    function admin_black(obj,id,status){
        layer.confirm('确认要加入黑名单吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……

            var url = SCOPE.status_black;
            $.post(url,{status:status,id:id},function(data){
                if(data.code == 1001){

                    layer.msg(data.msg,{icon: 1,time:1000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon: 2,time:1000});
                }
            });
        });
    }

    /*机构-启用*/
    function admin_all(){
        layer.confirm('确认要批量推送线索吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……

            var loding=showLoad();

            var url = SCOPE.status_urla;
            var chk_value =[];
            $('input[name="idcheckbox"]:checked').each(function(){ //遍历，将所有选中的值放到数组中
                chk_value.push($(this).val());
            });



            $.post(url,{status:1,id:chk_value},function(data){
                if(data.code == 1001){

                    layer.msg(data.msg,{icon: 1,time:3000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon: 2,time:1000});
                }
                closeLoad(loding);
            });

        });
    }

    /*查看重复*/
    function selectclue(obj,phone){
        location.href='{:url("clue/index")}?clue_name=&phone='+phone+'&status=99&pro_id=&times='
    }

    laydate.render({
        elem: '#times'
        ,type: 'datetime'
        ,range: true
    });

    laydate.render({
        elem: '#times2'
        ,type: 'datetime'
        ,range: true
    });

    laydate.render({
        elem: '#week-selector',
        type: 'date',
        first: 1,
        done: function(value, date){
            // 选择结束后的回调
            // value: 日期的格式化值，如 '2021-01-01'
            // date: 日期对象，可以获取年月日信息
            var weekIndex = date.week; // 获取第几周
            console.log('选择的是第 ' + weekIndex + ' 周');
            console.log(date);
        }
    });


    function showLoad() {

        return layer.msg('拼命执行中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: 'auto', time:100000});

    }

    function closeLoad(index) {
        layer.close(index);

    }

    // $('#pro_id').find('option[value="{$pro_id}"]').attr('selected',true);
    // $('#channel_id').find('option[value="{$channel_id}"]').attr('selected',true);

    $('#pro_id').val('{$pro_id}');
    $('#channel_id').val('{$channel_id}')
    $('#is_not_push').val('{$is_not_push}')
    $('#is_follow').val('{$is_follow}')
    $('#youhua_id').val('{$youhua_id}');
    $('#pay_type').val('{$pay_type}');
    $('#stat_type').val('{$stat_type}');

    $(function (){
        var stat_type = $("#stat_type").val();
        if (stat_type == 1) { // 单日
            $("#stat_type_for_day").show();
            $("#stat_type_for_week").hide();
        } else if (stat_type == 2) { // 周期
            $("#stat_type_for_day").hide();
            $("#stat_type_for_week").show();
        }
    })


</script>
<script src="__STATIC__/layui/layui.js"></script>
<script>
    layui.use(['form','upload', 'element', 'layer'], function() {
        var form = layui.form;
        var $ = layui.jquery
            , upload = layui.upload
            , element = layui.element
            , layer = layui.layer;

        //选完文件后不自动上传
        upload.render({
            elem: '#test8'
            ,url: "{:url('clue/importClue')}" //此处配置你自己的上传接口即可
            ,auto: false
            //,multiple: true
            ,accept:'file'
            ,bindAction: '#test9'
            ,done: function(res){
                if(res.code == 1001){
                    layer.msg(res.msg,{icon: 1,time:1000},function(){
                        window.location.reload();
                    });
                }else{

                    layer.alert(res.msg, {

                        closeBtn: 0
                        ,anim: 4 //动画类型
                    });
                    // layer.msg(res.msg,{icon: 2,time:3000});
                }
            }
        });
    });


    $(function () {

        $('dl > dd').on('click',function (){
            loadRule('merchant','mrule')
        })
    });
</script>
<link rel="stylesheet" href="__STATIC__/multiple-select-1.6.0/dist/multiple-select.css">

<!-- Latest compiled and minified JavaScript -->
<script src="__STATIC__/multiple-select-1.6.0/dist/multiple-select.js"></script>
<script>
    $('#pstatus').multipleSelect({
        selectAll:false//是否有全选按钮

    });

    var sceneIdList ="{$pstatus}";


    sceneIdArr = sceneIdList.split(",");


    $('#pstatus option').each(function (i, content) {

        if ($.inArray($.trim(content.value), sceneIdArr) >= 0) {

            this.selected = true;

        }

    });
    //加载完勾选项后也要刷新
    $("#pstatus").multipleSelect('refresh');

</script>
</html>




























